package qgs.zisu.javaconcurrency.javaconcurrency.chapter8_DeadLock;

/**
 * @Author: 蔡翔
 * @Date: 2019/10/12 19:15
 * @Version 1.0
 */
public class DeadLock {
    private OtherService otherService;
    public final Object LOCK = new Object();

    public DeadLock(OtherService otherService){
        this.otherService = otherService;
    }


    public void m1(){
        synchronized (LOCK){
            System.out.println("m1");
            otherService.s1();
        }
    }
    public void m2(){
        synchronized (LOCK){
            System.out.println("m2");
        }
    }
}
